<%@page import="pl.gladiator.model.User"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="/gladiator-app/public/js/skin.js"></script>
<title>Gladiator</title>
<style type="text/css">
a {
	color: #954930;
	text-decoration: none;
}

a:hover {
	color: red;
}
</style>
</head>

<body>

	<%
		User user = (User) session.getAttribute("user");
		String message = (String) request.getAttribute("message");
		String txt;
		if (message != null) {
			txt = message;
			//w Klasie LogujAction jest generowana wiadomosc(message)
			//mozna by bylo tez wyswietlic napis: witaj XXX
			//w sposob: user.getImie()
		} else {
			txt = "";
		}

		if (user != null) {

			if (user.getType().equals("a")) {
	%>
	<div id="witaj">
		Witaj
		<%=user.getFirstname()%>
		<font color=red><a href="/gladiator-app/flow/showAdmin">
				|Panel Admina|</a></font> <a href="/gladiator-app/users/logout">wyloguj</a>
	</div>
	<%
		} else if (user.getType().equals("u")) {

				if (user.getActivate().equals("NIE")) {
	%>

	<div id="witaj">
		Witaj
		<%=user.getFirstname()%>, Twoje konto jest nieaktywne, <a
			href="/gladiator-app/users/logout">wyloguj</a>
	</div>

	<%
		} else {
	%>


	<div id="witaj">

		Witaj
		<%=user.getFirstname()%>
		<a href="#">|Moj profil|</a> <a href="/gladiator-app/users/logout">wyloguj</a>
	</div>

	<%
		}
			} else {
				response.sendError(404, "Gladiator: blad sesji");
			}
		} else {
	%>
	<%=txt%>


	<div id="login">
		<form:form commandName="user" action="/gladiator-app/users/login"
			method="post">
			<table style="width: 250px;">
				<tr>
					<td>login</td>
					<td style="clor: black;"><form:input path="login" id="logins" /></td>
					<td>haslo</td>
					<td><form:password id="password" path="password" /></td>
					<td><button type="submit">Loguj</button></td>
					<td><a href="/gladiator-app/users/register">JOIN</a></td>
				</tr>
			</table>
		</form:form>
		

	</div>
	<%
		}
	%>
</body>
</html>